/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session02;

/**
 *
 * @author macbookpro
 */
public class AccountWithdraw implements Runnable {

    private Account a;

    public AccountWithdraw(Account a) {
        this.a = a;
    }

    @Override
    public void run() {
        synchronized (a) {
            while (!a.withdraw(100));
            System.out.print("withdraw 100");
            System.out.println(", balance: " + a.getBalance());
        }
    }
}
